#ifndef EDITOR_MANAGER_H
#define EDITOR_MANAGER_H

#include "_qhashhelper.h"

#include "../editors/ieditor.h"
#include "../mimetypes/mimetype.h"

#include <QtCore/QHash>

namespace core
{

class EditorManager
{
public:
    static EditorManager* getInstance();
    static void destroy();

    void registerEditor(const MimeType& type, IEditor* editor);
    void unregisterEditor(const MimeType& type);

    QSharedPointer<IEditor> editor(const MimeType& type) const;

private:
    EditorManager();
    ~EditorManager();

private:
    QHash<MimeType, IEditor*> m_registeredEditors;
};

} // namespace core

#endif
